package com.remedios.bugHandle.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.system.api.domain.SubmitBug;
import com.remedios.bugHandle.mapper.SubmitBugMapper;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.remedios.bugHandle.service.ISubmitBugService;

/**
 * BUG提交Service业务层处理
 *
 * @author remedios
 * @date 2022-08-25
 */
@Service
public class SubmitBugServiceImpl implements ISubmitBugService {
    @Autowired
    private SubmitBugMapper submitBugMapper;

    /**
     * 查询BUG提交
     *
     * @param id BUG提交主键
     * @return BUG提交
     */
    @Override
    public SubmitBug selectSubmitBugById(Integer id) {
        return submitBugMapper.selectSubmitBugById(id);
    }

    /**
     * 查询BUG提交列表
     *
     * @param submitBug BUG提交
     * @return BUG提交
     */
    @Override
    public List<SubmitBug> selectSubmitBugList(SubmitBug submitBug) {
        return submitBugMapper.selectSubmitBugList(submitBug);
    }

    /**
     * 新增BUG提交
     *
     * @param submitBug BUG提交
     * @return 结果
     */
    @Override
    public int insertSubmitBug(SubmitBug submitBug) {
        submitBug.setCreateTime(DateUtils.getNowDate());
        submitBug.setCreateBy(SecurityUtils.getUsername());
        return submitBugMapper.insertSubmitBug(submitBug);
    }

    /**
     * 修改BUG提交
     *
     * @param submitBug BUG提交
     * @return 结果
     */
    @Override
    public int updateSubmitBug(SubmitBug submitBug) {
        submitBug.setUpdateTime(DateUtils.getNowDate());
        return submitBugMapper.updateSubmitBug(submitBug);
    }

    /**
     * 批量删除BUG提交
     *
     * @param ids 需要删除的BUG提交主键
     * @return 结果
     */
    @Override
    public int deleteSubmitBugByIds(Integer[] ids) {
        return submitBugMapper.deleteSubmitBugByIds(ids);
    }

    /**
     * 删除BUG提交信息
     *
     * @param id BUG提交主键
     * @return 结果
     */
    @Override
    public int deleteSubmitBugById(Integer id) {
        return submitBugMapper.deleteSubmitBugById(id);
    }

    @Override
    public int responseSubmitBugByIds(Integer[] ids) {
        String Handler = SecurityUtils.getUsername();
        return submitBugMapper.responseSubmitBugByIds(ids,Handler,new Date());
    }
}
